// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
export default class Debuger {
    private static _graphcis: cc.Graphics = null;
    
    static getGraphcis() {
        if (!this._graphcis) {
            let node = new cc.Node("Debuger Graphcis");
            cc.game.addPersistRootNode(node);
            this._graphcis = node.addComponent(cc.Graphics);
            node.setContentSize(cc.winSize);
            node.setPosition(cc.v2(cc.winSize.width * 0.5, cc.winSize.height * 0.5));
        }
        return this._graphcis;
    }

    static drawGraphcisBox() {
        let graphics = this.getGraphcis();
        graphics.lineWidth = 4;
        graphics.strokeColor = cc.Color.WHITE;
        graphics.rect(-cc.winSize.width * 0.5, -cc.winSize.height * 0.5, cc.winSize.width, cc.winSize.height);
        graphics.stroke();
    }
}
